package com.codenum.codegenerator;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
* the Gkwtpxvm type
*/
@SuppressWarnings("ALL")
public class Gkwtpxvm {


        private static volatile Gkwtpxvm instance;

        /**
        * 方法MethodMap
        */
        private Map<String, Method> methodMap = new HashMap<>(32);

        private Map<String, Object> saleTypeMap = new HashMap<>(64);

        public static Gkwtpxvm getInstance() {
            if (instance == null) {
                synchronized (Gkwtpxvm.class) {
                    if (instance == null) {
                        instance = new Gkwtpxvm();
                    }
                }
            }
            return instance;
        }


        private Gkwtpxvm() {

        }



    public  Boolean judgeBljrjbfbfw(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeOzuldmznyq(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeIdgmczccut(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeRhwlmwedyl(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeXninybococ(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeSwqubbapim(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeJbnzixlbwr(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeDjsbkvrnjo(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeCtltiqvhkt(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }

    private String  bljrjbfbfw;
    private String  ozuldmznyq;
    private String  idgmczccut;
    private String  rhwlmwedyl;
    private String  xninybococ;
    private String  swqubbapim;
    private String  jbnzixlbwr;
    private String  djsbkvrnjo;
    private String  ctltiqvhkt;


    public void setBljrjbfbfw(String bljrjbfbfw){
    this.bljrjbfbfw = bljrjbfbfw;
    }

    public String getBljrjbfbfw(){
    return this.bljrjbfbfw;
    }
    public void setOzuldmznyq(String ozuldmznyq){
    this.ozuldmznyq = ozuldmznyq;
    }

    public String getOzuldmznyq(){
    return this.ozuldmznyq;
    }
    public void setIdgmczccut(String idgmczccut){
    this.idgmczccut = idgmczccut;
    }

    public String getIdgmczccut(){
    return this.idgmczccut;
    }
    public void setRhwlmwedyl(String rhwlmwedyl){
    this.rhwlmwedyl = rhwlmwedyl;
    }

    public String getRhwlmwedyl(){
    return this.rhwlmwedyl;
    }
    public void setXninybococ(String xninybococ){
    this.xninybococ = xninybococ;
    }

    public String getXninybococ(){
    return this.xninybococ;
    }
    public void setSwqubbapim(String swqubbapim){
    this.swqubbapim = swqubbapim;
    }

    public String getSwqubbapim(){
    return this.swqubbapim;
    }
    public void setJbnzixlbwr(String jbnzixlbwr){
    this.jbnzixlbwr = jbnzixlbwr;
    }

    public String getJbnzixlbwr(){
    return this.jbnzixlbwr;
    }
    public void setDjsbkvrnjo(String djsbkvrnjo){
    this.djsbkvrnjo = djsbkvrnjo;
    }

    public String getDjsbkvrnjo(){
    return this.djsbkvrnjo;
    }
    public void setCtltiqvhkt(String ctltiqvhkt){
    this.ctltiqvhkt = ctltiqvhkt;
    }

    public String getCtltiqvhkt(){
    return this.ctltiqvhkt;
    }

    void setMethodMap(Map<String, Method> methodMap) {
        this.methodMap = methodMap;
    }

   void setSaleTypeMap(Map<String, Object> saleTypeMap) {
        this.saleTypeMap = saleTypeMap;
    }

    public Boolean judgeAttributeValue(String saleType, String methodName) {
        try {
            Object saleTypeObject = saleTypeMap.get(saleType);
            String targetMethod = methodName.replace("judge", "get");
            String attr = methodName.replace("judge", "");
            Method method = methodMap.get(targetMethod);
            Object invoke = method.invoke(saleTypeObject);
            return Objects.isNull(invoke) ? Boolean.FALSE : Objects.equals(invoke.toString().toLowerCase(), attr.toLowerCase());
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e.getMessage());
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e.getMessage());
        }
    }

}